<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2015/10/26
  Time: 22:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>ajax版的列表</title>
    <script src="scripts/jquery-1.11.2.min.js"></script>
    <script>
        $(function(){
            $("#btn1").click(function(){
                var url="/json/info_list";
                var args={"time":new Date()};
                $.post(url,args,function(data){
                    //alert(data);
                    $.each(data,function(i,item){
                        $tr = $("<tr></tr>");
                        $tr.append("<td>"+item.id+"</td>");
                        $tr.append("<td>"+item.name+"</td>");
                        $tr.append("<td>"+item.age+"</td>");
                        $tr.append("<td><a href='/json/info_delete?id="+item.id+"'>删除</a>" +
                                "<a href='/json/info_editForm?id="+item.id+"'>修改</a></td>");
                        $tr.appendTo($("#content"));
                    })
                })
            });
            $("#btn2").click(function(){
                var url="/json/info_editForm?id=1";
                var args={"time":new Date()};
                $.post(url,args,function(data){
                    alert(data);
                });
            })
        })
    </script>
</head>
<body>
    <button id="btn1">获取信息列表</button>
    <button id="btn2">获取info</button>
    <table id="content">
        <tr>
            <td>id</td>
            <td>name</td>
            <td>age</td>
            <td>删除修改</td>
        </tr>
    </table>
</body>
</html>
